package com.exia.android.socialnet.facebook;


import com.exia.android.socialnet.R;
import com.facebook.android.AsyncFacebookRunner;
import com.facebook.android.Facebook;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;
import android.widget.TextView;
import android.widget.ToggleButton;

public class FacebookActivity extends Activity implements CompoundButton.OnCheckedChangeListener, View.OnClickListener, View.OnFocusChangeListener{
	public static final String APP_ID = "190309757652772";
	static final class colors {
		public static final int FACEBOOK_DARK_BLUE = R.color.facebook_dark_blue;
		public static final int FACEBOOK_LIGHT_BLUE = R.color.facebook_light_blue;
		public static final int FACEBOOK_LIGHT_GREY = R.color.facebook_light_grey;
		public static final int FACEBOOK_WHITE = R.color.white;
	}
    Facebook mFacebook;
    AsyncFacebookRunner mAsyncRunner;
    private RelativeLayout facebookWindow;
    private RelativeLayout facebookBar;
    private RelativeLayout facebookBarLogoArea;
    //private ImageView facebookBarLogo;
    private TextView facebookBarTitle;
    private RelativeLayout facebookBarActivitiesArea;
    private ToggleButton facebookBarFriendsActivitiesButton;
    private ToggleButton facebookBarMessagesActivitiesButton;
    private ToggleButton facebookBarNotificationsActivitiesButton;
    private RelativeLayout facebookBarMenuArea;
    private LinearLayout facebookBarMenuAreaTopBorder;
    private LinearLayout facebookBarMenuAreaLeftBorder;
    private LinearLayout facebookBarMenuAreaRightBorder;
    private LinearLayout facebookBarMenuAreaBottomBorder;
    private Button facebookBarHomeButton;
    private Button facebookBarProfilButton;
    private ToggleButton facebookBarAccountButton;
    private RelativeLayout facebookBarFriendsActivitiesListView;
    private RelativeLayout facebookBarFriendsActivitiesListTitleArea;
    private TextView facebookBarFriendsActivitiesListTitle;
    private Button facebookBarFriendsActivitiesListFindFriendsButton;
    private ImageView facebookBarFriendsActivitiesListTitleAreaSeparator;
    private RelativeLayout facebookBarFriendsActivitiesListContainer;
    private RelativeLayout facebookBarFriendsActivitiesListFooterArea;
    private LinearLayout facebookBarFriendsActivitiesListFooterTopBorder;
    private ToggleButton facebookBarFriendsActivitiesListShowAllFriendsButton;
    private RelativeLayout facebookBarAccountOptionsView;
    private RelativeLayout facebookBarAccountOptionsViewProfil;
    private ImageView facebookBarAccountOptionsViewProfilImage;
    private TextView facebookBarAccountOptionsViewProfilUserName;
    private ToggleButton facebookBarAccountOptionsViewManageFriendsButton;
    private ToggleButton facebookBarAccountOptionsViewAccountSettingsButton;
    private ToggleButton facebookBarAccountOptionsViewPrivacySettingsButton;
    private ToggleButton facebookBarAccountOptionsViewHelpButton;
    private ToggleButton facebookBarAccountOptionsViewLogoutButton;
    private RelativeLayout facebookBarNotificationsActivitiesListView;
    
    private RelativeLayout facebookBarMessagesActivitiesListView;
    
    private RelativeLayout facebookWindowWrapper;
    
    private RelativeLayout facebookLoginForm;
    
    private void loadFacebookWindow(){
    	facebookWindow = (RelativeLayout) this.findViewById(R.id.window);
    	facebookWindow.setOnClickListener(this);
    	this.loadFacebookBar();
    	this.loadFacebookWindowWrapper();
    	this.loadFacebookBarFriendsActivitiesListView();
        this.loadFacebookBarMessagesActivitiesListView();
        this.loadFacebookBarNotificationsActivitiesListView();
    	this.loadFacebookBarAccountOptionsView();
    }
    
    private void loadFacebookBar(){
    	facebookBar = (RelativeLayout) this.findViewById(R.id.facebook_bar);
    	facebookBarLogoArea = (RelativeLayout) this.findViewById(R.id.facebook_bar_logo_area);
    	//facebookBarLogo = (ImageView) this.findViewById(R.id.facebook_bar_logo);
    	facebookBarTitle = (TextView) this.findViewById(R.id.facebook_bar_title);
    	facebookBarActivitiesArea = (RelativeLayout) this.findViewById(R.id.facebook_bar_activities_area);
    	facebookBarFriendsActivitiesButton = (ToggleButton) this.findViewById(R.id.facebook_bar_friends_activities_button);
    	facebookBarFriendsActivitiesButton.setOnCheckedChangeListener(this);
    	facebookBarMessagesActivitiesButton = (ToggleButton) this.findViewById(R.id.facebook_bar_messages_activities_button);
    	facebookBarMessagesActivitiesButton.setOnCheckedChangeListener(this);
    	facebookBarNotificationsActivitiesButton = (ToggleButton) this.findViewById(R.id.facebook_bar_notifications_activities_button);
    	facebookBarNotificationsActivitiesButton.setOnCheckedChangeListener(this);
    	facebookBarMenuArea = (RelativeLayout) this.findViewById(R.id.facebook_bar_menu_area);
    	facebookBarMenuAreaTopBorder = (LinearLayout) this.findViewById(R.id.facebook_bar_menu_area_top_border);
        facebookBarMenuAreaLeftBorder = (LinearLayout) this.findViewById(R.id.facebook_bar_menu_area_left_border);
        facebookBarMenuAreaRightBorder = (LinearLayout) this.findViewById(R.id.facebook_bar_menu_area_right_border);
        facebookBarMenuAreaBottomBorder = (LinearLayout) this.findViewById(R.id.facebook_bar_menu_area_bottom_border);
        facebookBarHomeButton = (Button) this.findViewById(R.id.facebook_bar_home_button);
        facebookBarHomeButton.setOnClickListener(this);
        facebookBarProfilButton = (Button) this.findViewById(R.id.facebook_bar_profil_button);
        facebookBarProfilButton.setOnClickListener(this);
        facebookBarAccountButton = (ToggleButton) this.findViewById(R.id.facebook_bar_account_button);
        facebookBarAccountButton.setOnCheckedChangeListener(this);
        
    }
    
    private void loadFacebookBarFriendsActivitiesListView(){
    	facebookBarFriendsActivitiesListView = (RelativeLayout) this.findViewById(R.id.facebook_bar_friends_activities_list_view);
    	facebookBarFriendsActivitiesListTitleArea = (RelativeLayout) this.findViewById(R.id.facebook_bar_friends_activities_list_title_area);
    	facebookBarFriendsActivitiesListTitle = (TextView) this.findViewById(R.id.facebook_bar_friends_activities_list_title);
    	facebookBarFriendsActivitiesListFindFriendsButton = (Button) this.findViewById(R.id.facebook_bar_friends_activities_list_find_friends_button);
    	facebookBarFriendsActivitiesListTitleAreaSeparator = (ImageView) this.findViewById(R.id.facebook_bar_friends_activities_list_title_area_separator);
    	facebookBarFriendsActivitiesListContainer = (RelativeLayout) this.findViewById(R.id.facebook_bar_friends_activities_list_container);
    	facebookBarFriendsActivitiesListFooterArea = (RelativeLayout) this.findViewById(R.id.facebook_bar_friends_activities_list_footer_area);
    	facebookBarFriendsActivitiesListFooterTopBorder = (LinearLayout) this.findViewById(R.id.facebook_bar_friends_activities_list_footer_top_border);
    	facebookBarFriendsActivitiesListShowAllFriendsButton = (ToggleButton) this.findViewById(R.id.facebook_bar_friends_activities_list_show_all_friends_button);
    }
    private void loadFacebookBarMessagesActivitiesListView(){
    	facebookBarMessagesActivitiesListView = (RelativeLayout) this.findViewById(R.id.facebook_bar_messages_activities_list_view);
    }
    private void loadFacebookBarNotificationsActivitiesListView(){
    	facebookBarNotificationsActivitiesListView = (RelativeLayout) this.findViewById(R.id.facebook_bar_notifications_activities_list_view);
    }
    private void loadFacebookBarAccountOptionsView(){
    	facebookBarAccountOptionsView = (RelativeLayout) this.findViewById(R.id.facebook_bar_account_options_view);
    	facebookBarAccountOptionsViewProfil = (RelativeLayout) this.findViewById(R.id.facebook_bar_account_options_view_profil);
    	facebookBarAccountOptionsViewProfilImage = (ImageView) this.findViewById(R.id.facebook_bar_account_options_view_profil_image);
    	facebookBarAccountOptionsViewProfilUserName = (TextView) this.findViewById(R.id.facebook_bar_account_options_view_profil_user_name);
    	facebookBarAccountOptionsViewManageFriendsButton = (ToggleButton) this.findViewById(R.id.facebook_bar_account_options_view_manage_friends_button);
    	facebookBarAccountOptionsViewManageFriendsButton.setOnCheckedChangeListener(this);
    	facebookBarAccountOptionsViewAccountSettingsButton = (ToggleButton) this.findViewById(R.id.facebook_bar_account_options_view_account_settings_button);
    	facebookBarAccountOptionsViewAccountSettingsButton.setOnCheckedChangeListener(this);
    	facebookBarAccountOptionsViewPrivacySettingsButton = (ToggleButton) this.findViewById(R.id.facebook_bar_account_options_view_privacy_settings_button);
    	facebookBarAccountOptionsViewPrivacySettingsButton.setOnCheckedChangeListener(this);
    	facebookBarAccountOptionsViewHelpButton = (ToggleButton) this.findViewById(R.id.facebook_bar_account_options_view_help_button);
    	facebookBarAccountOptionsViewHelpButton.setOnCheckedChangeListener(this);
    	facebookBarAccountOptionsViewLogoutButton = (ToggleButton) this.findViewById(R.id.facebook_bar_account_options_view_logout_button);
    	facebookBarAccountOptionsViewLogoutButton.setOnCheckedChangeListener(this);
    }
    private void loadFacebookWindowWrapper(){
    	facebookWindowWrapper = (RelativeLayout) this.findViewById(R.id.facebook_window_wrapper);
    	facebookWindowWrapper.setOnClickListener(this);
    }
    
    private void loadFacebookLoginForm(){
    	
    }
    private class WebClient extends WebViewClient{
    	
    }
	@Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
    	/*WebView webView_l = new WebView(this.getBaseContext());
        webView_l.getSettings().setJavaScriptEnabled(true);
        webView_l.setWebViewClient(new WebClient());
        this.setContentView(webView_l);
        webView_l.setLayoutParams(new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        webView_l.loadUrl("http://www.facebook.com/");*/
    	setContentView(R.layout.main);
    	this.loadFacebookWindow();
	}

    @Override
    protected void onActivityResult(int requestCode, int resultCode,
                                    Intent data) {
        mFacebook.authorizeCallback(requestCode, resultCode, data);
    }

	public Facebook getmFacebook() {
		return mFacebook;
	}

	public AsyncFacebookRunner getmAsyncRunner() {
		return mAsyncRunner;
	}

	public RelativeLayout getFacebookWindow() {
		return facebookWindow;
	}

	public RelativeLayout getFacebookBar() {
		return facebookBar;
	}

	public RelativeLayout getFacebookBarLogoArea() {
		return facebookBarLogoArea;
	}

	/*
	public ImageView getFacebookBarLogo() {
		return facebookBarLogo;
	}
	*/
	public TextView getFacebookBarTitle() {
		return facebookBarTitle;
	}

	public RelativeLayout getFacebookBarActivitiesArea() {
		return facebookBarActivitiesArea;
	}

	public ToggleButton getFacebookBarFriendsActivitiesButton() {
		return facebookBarFriendsActivitiesButton;
	}

	public ToggleButton getFacebookBarMessagesActivitiesButton() {
		return facebookBarMessagesActivitiesButton;
	}

	public ToggleButton getFacebookBarNotificationsActivitiesButton() {
		return facebookBarNotificationsActivitiesButton;
	}

	public RelativeLayout getFacebookBarMenuArea() {
		return facebookBarMenuArea;
	}

	public LinearLayout getFacebookBarMenuAreaTopBorder() {
		return facebookBarMenuAreaTopBorder;
	}

	public LinearLayout getFacebookBarMenuAreaLeftBorder() {
		return facebookBarMenuAreaLeftBorder;
	}

	public LinearLayout getFacebookBarMenuAreaRightBorder() {
		return facebookBarMenuAreaRightBorder;
	}

	public LinearLayout getFacebookBarMenuAreaBottomBorder() {
		return facebookBarMenuAreaBottomBorder;
	}

	public Button getFacebookBarHomeButton() {
		return facebookBarHomeButton;
	}

	public Button getFacebookBarProfilButton() {
		return facebookBarProfilButton;
	}

	public ToggleButton getFacebookBarAccountButton() {
		return facebookBarAccountButton;
	}

	public RelativeLayout getFacebookBarFriendsActivitiesListView() {
		return facebookBarFriendsActivitiesListView;
	}

	public RelativeLayout getFacebookBarFriendsActivitiesListTitleArea() {
		return facebookBarFriendsActivitiesListTitleArea;
	}

	public TextView getFacebookBarFriendsActivitiesListTitle() {
		return facebookBarFriendsActivitiesListTitle;
	}

	public Button getFacebookBarFriendsActivitiesListFindFriendsButton() {
		return facebookBarFriendsActivitiesListFindFriendsButton;
	}

	public ImageView getFacebookBarFriendsActivitiesListTitleAreaSeparator() {
		return facebookBarFriendsActivitiesListTitleAreaSeparator;
	}

	public RelativeLayout getFacebookBarFriendsActivitiesListContainer() {
		return facebookBarFriendsActivitiesListContainer;
	}

	public RelativeLayout getFacebookBarFriendsActivitiesListFooterArea() {
		return facebookBarFriendsActivitiesListFooterArea;
	}

	public LinearLayout getFacebookBarFriendsActivitiesListFooterTopBorder() {
		return facebookBarFriendsActivitiesListFooterTopBorder;
	}

	public Button getFacebookBarFriendsActivitiesListShowAllFriendsButton() {
		return facebookBarFriendsActivitiesListShowAllFriendsButton;
	}

	public RelativeLayout getFacebookBarAccountOptionsView() {
		return facebookBarAccountOptionsView;
	}

	public RelativeLayout getFacebookBarAccountOptionsViewProfil() {
		return facebookBarAccountOptionsViewProfil;
	}

	public ImageView getFacebookBarAccountOptionsViewProfilImage() {
		return facebookBarAccountOptionsViewProfilImage;
	}

	public TextView getFacebookBarAccountOptionsViewProfilUserName() {
		return facebookBarAccountOptionsViewProfilUserName;
	}

	public ToggleButton getFacebookBarAccountOptionsViewManageFriendsButton() {
		return facebookBarAccountOptionsViewManageFriendsButton;
	}

	public ToggleButton getFacebookBarAccountOptionsViewAccountSettingsButton() {
		return facebookBarAccountOptionsViewAccountSettingsButton;
	}

	public ToggleButton getFacebookBarAccountOptionsViewPrivacySettingsButton() {
		return facebookBarAccountOptionsViewPrivacySettingsButton;
	}

	public ToggleButton getFacebookBarAccountOptionsViewHelpButton() {
		return facebookBarAccountOptionsViewHelpButton;
	}

	public ToggleButton getFacebookBarAccountOptionsViewLogoutButton() {
		return facebookBarAccountOptionsViewLogoutButton;
	}

	@Override
	public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
		if(buttonView == facebookBarAccountButton){
			if(isChecked == true){
				if(facebookBarFriendsActivitiesButton.isChecked() == true){
					facebookBarFriendsActivitiesButton.setChecked(false);
				}
				if(facebookBarMessagesActivitiesButton.isChecked() == true){
					facebookBarMessagesActivitiesButton.setChecked(false);
				}
				if(facebookBarNotificationsActivitiesButton.isChecked() == true){
					facebookBarNotificationsActivitiesButton.setChecked(false);
				}
				facebookBarAccountButton.setBackgroundColor(getResources().getColor(R.drawable.white));
				facebookBarAccountButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.fleche_1, 0);
				facebookBarAccountButton.setTextColor(getResources().getColor(R.color.facebook_dark_blue));
				Rect rect_l = new Rect();
				facebookBar.findViewById(R.id.facebook_bar_menu_area_bottom_border).getDrawingRect(rect_l);
				RelativeLayout.LayoutParams layout_l = (LayoutParams) facebookBarAccountOptionsView.getLayoutParams();
				layout_l.topMargin = rect_l.bottom-2;
				if(facebookBarAccountOptionsView.getVisibility() == View.GONE){
					facebookBarAccountOptionsView.setVisibility(View.VISIBLE);
				}
			}else{
				facebookBarAccountButton.setBackgroundColor(getResources().getColor(R.color.facebook_light_blue));
				facebookBarAccountButton.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.fleche, 0);
				facebookBarAccountButton.setTextColor(getResources().getColor(R.drawable.white));
				if(facebookBarAccountOptionsView.getVisibility() == View.VISIBLE){
					facebookBarAccountOptionsView.setVisibility(View.GONE);
				}
				if(facebookBarAccountOptionsViewAccountSettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewAccountSettingsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewManageFriendsButton.isChecked() == true){
					facebookBarAccountOptionsViewManageFriendsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewLogoutButton.isChecked() == true){
					facebookBarAccountOptionsViewLogoutButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewHelpButton.isChecked() == true){
					facebookBarAccountOptionsViewHelpButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewPrivacySettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewPrivacySettingsButton.setChecked(false);
				}
			}
		}else if(buttonView == facebookBarFriendsActivitiesButton){
			if(isChecked == true){
				if(facebookBarAccountButton.isChecked() == true){
					facebookBarAccountButton.setChecked(false);
				}
				if(facebookBarMessagesActivitiesButton.isChecked() == true){
					facebookBarMessagesActivitiesButton.setChecked(false);
				}
				if(facebookBarNotificationsActivitiesButton.isChecked() == true){
					facebookBarNotificationsActivitiesButton.setChecked(false);
				}
				facebookBarFriendsActivitiesButton.setBackgroundColor(getResources().getColor(R.drawable.white));
				facebookBarFriendsActivitiesButton.setButtonDrawable(R.drawable.amis_1);
				int[] location_l = new int[2];
				facebookBarFriendsActivitiesButton.getLocationInWindow(location_l);
				RelativeLayout.LayoutParams layout_l = (LayoutParams) facebookBarFriendsActivitiesListView.getLayoutParams();
				layout_l.leftMargin = location_l[0]-1;
				if(facebookBarFriendsActivitiesListView.getVisibility() == View.GONE){
					facebookBarFriendsActivitiesListView.setVisibility(View.VISIBLE);
				}
			}else{
				facebookBarFriendsActivitiesButton.setBackgroundColor(getResources().getColor(R.color.facebook_dark_blue));
				facebookBarFriendsActivitiesButton.setButtonDrawable(R.drawable.amis_2);
				if(facebookBarFriendsActivitiesListView.getVisibility() == View.VISIBLE){
					facebookBarFriendsActivitiesListView.setVisibility(View.GONE);
				}
			}
		}else if(buttonView == facebookBarMessagesActivitiesButton){
			if(isChecked == true){
				if(facebookBarAccountButton.isChecked() == true){
					facebookBarAccountButton.setChecked(false);
				}
				if(facebookBarFriendsActivitiesButton.isChecked() == true){
					facebookBarFriendsActivitiesButton.setChecked(false);
				}
				if(facebookBarNotificationsActivitiesButton.isChecked() == true){
					facebookBarNotificationsActivitiesButton.setChecked(false);
				}
				facebookBarMessagesActivitiesButton.setBackgroundColor(getResources().getColor(R.drawable.white));
				facebookBarMessagesActivitiesButton.setButtonDrawable(R.drawable.messages_2);
				int[] location_l = new int[2];
				facebookBarMessagesActivitiesButton.getLocationInWindow(location_l);
				RelativeLayout.LayoutParams layout_l = (LayoutParams) facebookBarMessagesActivitiesListView.getLayoutParams();
				layout_l.leftMargin = location_l[0]-1;
				if(facebookBarMessagesActivitiesListView.getVisibility() == View.GONE){
					facebookBarMessagesActivitiesListView.setVisibility(View.VISIBLE);
				}
			}else{
				facebookBarMessagesActivitiesButton.setBackgroundColor(getResources().getColor(R.color.facebook_dark_blue));
				facebookBarMessagesActivitiesButton.setButtonDrawable(R.drawable.messages_1);
				if(facebookBarMessagesActivitiesListView.getVisibility() == View.VISIBLE){
					facebookBarMessagesActivitiesListView.setVisibility(View.GONE);
				}
			}
		}else if(buttonView == facebookBarNotificationsActivitiesButton){
			if(isChecked == true){
				if(facebookBarAccountButton.isChecked() == true){
					facebookBarAccountButton.setChecked(false);
				}
				if(facebookBarFriendsActivitiesButton.isChecked() == true){
					facebookBarFriendsActivitiesButton.setChecked(false);
				}
				if(facebookBarMessagesActivitiesButton.isChecked() == true){
					facebookBarMessagesActivitiesButton.setChecked(false);
				}
				facebookBarNotificationsActivitiesButton.setBackgroundColor(getResources().getColor(R.drawable.white));
				facebookBarNotificationsActivitiesButton.setButtonDrawable(R.drawable.notifications_1);
				int[] location_l = new int[2];
				facebookBarNotificationsActivitiesButton.getLocationInWindow(location_l);
				RelativeLayout.LayoutParams layout_l = (LayoutParams)facebookBarNotificationsActivitiesListView.getLayoutParams();
				layout_l.leftMargin = location_l[0]-1;
				if(facebookBarNotificationsActivitiesListView.getVisibility() == View.GONE){
					facebookBarNotificationsActivitiesListView.setVisibility(View.VISIBLE);
				}
			}else{
				facebookBarNotificationsActivitiesButton.setBackgroundColor(getResources().getColor(R.color.facebook_dark_blue));
				facebookBarNotificationsActivitiesButton.setButtonDrawable(R.drawable.notifications_2);
				if(facebookBarNotificationsActivitiesListView.getVisibility() == View.VISIBLE){
					facebookBarNotificationsActivitiesListView.setVisibility(View.GONE);
				}
			}
		}else if(buttonView == facebookBarAccountOptionsViewAccountSettingsButton){
			if(isChecked == true){
				if(facebookBarAccountOptionsViewManageFriendsButton.isChecked() == true){
					facebookBarAccountOptionsViewManageFriendsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewHelpButton.isChecked() == true){
					facebookBarAccountOptionsViewHelpButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewLogoutButton.isChecked() == true){
					facebookBarAccountOptionsViewLogoutButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewPrivacySettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewPrivacySettingsButton.setChecked(false);
				}
				facebookBarAccountOptionsViewAccountSettingsButton.setBackgroundColor(getResources().getColor(R.color.facebook_dark_blue));
				facebookBarAccountOptionsViewAccountSettingsButton.setTextColor(getResources().getColor(R.color.white));
			}else{
				facebookBarAccountOptionsViewAccountSettingsButton.setBackgroundColor(getResources().getColor(R.color.white));
				facebookBarAccountOptionsViewAccountSettingsButton.setTextColor(getResources().getColor(R.color.facebook_dark_blue));
			}
		}else if(buttonView == facebookBarAccountOptionsViewManageFriendsButton){
			if(isChecked == true){
				if(facebookBarAccountOptionsViewAccountSettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewAccountSettingsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewHelpButton.isChecked() == true){
					facebookBarAccountOptionsViewHelpButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewLogoutButton.isChecked() == true){
					facebookBarAccountOptionsViewLogoutButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewPrivacySettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewPrivacySettingsButton.setChecked(false);
				}
				facebookBarAccountOptionsViewManageFriendsButton.setBackgroundColor(getResources().getColor(R.color.facebook_dark_blue));
				facebookBarAccountOptionsViewManageFriendsButton.setTextColor(getResources().getColor(R.color.white));
			}else{
				facebookBarAccountOptionsViewManageFriendsButton.setBackgroundColor(getResources().getColor(R.color.white));
				facebookBarAccountOptionsViewManageFriendsButton.setTextColor(getResources().getColor(R.color.facebook_dark_blue));
			}
		}else if(buttonView == facebookBarAccountOptionsViewHelpButton){
			if(isChecked == true){
				if(facebookBarAccountOptionsViewAccountSettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewAccountSettingsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewManageFriendsButton.isChecked() == true){
					facebookBarAccountOptionsViewManageFriendsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewLogoutButton.isChecked() == true){
					facebookBarAccountOptionsViewLogoutButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewPrivacySettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewPrivacySettingsButton.setChecked(false);
				}
				facebookBarAccountOptionsViewHelpButton.setBackgroundColor(getResources().getColor(R.color.facebook_dark_blue));
				facebookBarAccountOptionsViewHelpButton.setTextColor(getResources().getColor(R.color.white));
			}else{
				facebookBarAccountOptionsViewHelpButton.setBackgroundColor(getResources().getColor(R.color.white));
				facebookBarAccountOptionsViewHelpButton.setTextColor(getResources().getColor(R.color.facebook_dark_blue));
			}
		}else if(buttonView == facebookBarAccountOptionsViewLogoutButton){
			if(isChecked == true){
				if(facebookBarAccountOptionsViewAccountSettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewAccountSettingsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewManageFriendsButton.isChecked() == true){
					facebookBarAccountOptionsViewManageFriendsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewHelpButton.isChecked() == true){
					facebookBarAccountOptionsViewHelpButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewPrivacySettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewPrivacySettingsButton.setChecked(false);
				}
				facebookBarAccountOptionsViewLogoutButton.setBackgroundColor(getResources().getColor(R.color.facebook_dark_blue));
				facebookBarAccountOptionsViewLogoutButton.setTextColor(getResources().getColor(R.color.white));
			}else{
				facebookBarAccountOptionsViewLogoutButton.setBackgroundColor(getResources().getColor(R.color.white));
				facebookBarAccountOptionsViewLogoutButton.setTextColor(getResources().getColor(R.color.facebook_dark_blue));
			}
		}else if(buttonView == facebookBarAccountOptionsViewPrivacySettingsButton){
			if(isChecked == true){
				if(facebookBarAccountOptionsViewAccountSettingsButton.isChecked() == true){
					facebookBarAccountOptionsViewAccountSettingsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewManageFriendsButton.isChecked() == true){
					facebookBarAccountOptionsViewManageFriendsButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewHelpButton.isChecked() == true){
					facebookBarAccountOptionsViewHelpButton.setChecked(false);
				}
				if(facebookBarAccountOptionsViewLogoutButton.isChecked() == true){
					facebookBarAccountOptionsViewLogoutButton.setChecked(false);
				}
				facebookBarAccountOptionsViewPrivacySettingsButton.setBackgroundColor(getResources().getColor(R.color.facebook_dark_blue));
				facebookBarAccountOptionsViewPrivacySettingsButton.setTextColor(getResources().getColor(R.color.white));
			}else{
				facebookBarAccountOptionsViewPrivacySettingsButton.setBackgroundColor(getResources().getColor(R.color.white));
				facebookBarAccountOptionsViewPrivacySettingsButton.setTextColor(getResources().getColor(R.color.facebook_dark_blue));
			}
		}
	}

	@Override
	public void onClick(View v) {
		if(v == facebookWindow){//if facebook window clicked
			//not defined yet
		}else if(v == facebookWindowWrapper){
			if(facebookBarFriendsActivitiesButton.isChecked() == true){
				facebookBarFriendsActivitiesButton.setChecked(false);
			}
			if(facebookBarMessagesActivitiesButton.isChecked() == true){
				facebookBarMessagesActivitiesButton.setChecked(false);
			}
			if(facebookBarNotificationsActivitiesButton.isChecked() == true){
				facebookBarNotificationsActivitiesButton.setChecked(false);
			}
			if(facebookBarAccountButton.isChecked() == true){
				facebookBarAccountButton.setChecked(false);
			}
		}else if(v == facebookBarHomeButton){//else if facebook bar home button clicked
			if(facebookBarFriendsActivitiesButton.isChecked() == true){
				facebookBarFriendsActivitiesButton.setChecked(false);
			}
			if(facebookBarMessagesActivitiesButton.isChecked() == true){
				facebookBarMessagesActivitiesButton.setChecked(false);
			}
			if(facebookBarNotificationsActivitiesButton.isChecked() == true){
				facebookBarNotificationsActivitiesButton.setChecked(false);
			}
			if(facebookBarAccountButton.isChecked() == true){
				facebookBarAccountButton.setChecked(false);
			}
		}else if(v == facebookBarProfilButton){
			if(facebookBarFriendsActivitiesButton.isChecked() == true){
				facebookBarFriendsActivitiesButton.setChecked(false);
			}
			if(facebookBarMessagesActivitiesButton.isChecked() == true){
				facebookBarMessagesActivitiesButton.setChecked(false);
			}
			if(facebookBarNotificationsActivitiesButton.isChecked() == true){
				facebookBarNotificationsActivitiesButton.setChecked(false);
			}
			if(facebookBarAccountButton.isChecked() == true){
				facebookBarAccountButton.setChecked(false);
			}
		}
	}

	@Override
	public void onFocusChange(View v, boolean hasFocus) {
		// TODO Auto-generated method stub
		
	}

    
    
}
